﻿using System.Collections.Generic;
using System.Data;
using System.Linq;
using Smarly.Core;
using Smarly.Core.Database;

namespace Smarly.Forum.Bussines.Model
{
	public class ThreadsModel : ModelStateObject
	{
		public string HashTag { get; set; }
		public List<ThreadModel> Threads { get; set; }

		public ThreadsModel Get()
		{
			HashTag = HashTag.ToLower().Trim();

			return SqlRepository.ExecuteProcedureReader("Forum_Thread_List",
																					 new List<SpParam>
			                                     	{
			                                     		new SpParam {Name = "@hashTag", Value = HashTag, Type = DbType.String},
			                                     	}, null,
																						(reader) =>
																						{
																							return this;
																						});

		}
	}
}